#include <stdio.h>
#include <stdlib.h>

//结构体可以让C语言创建新的类型

struct Student
{
    char name[20]; //成员变量
    int age;
    double score;
};

struct Book
{
    char name[20];
    float price;
    char id[30];
};

int main()
{

    //创建一个结构体
    struct Student stu = {"小珍", 18, 100.0};
    printf("1. %s %d %lf \n", stu.name, stu.age, stu.score);

    //创建一个结构体指针
    struct Student *ps;
    ps = &stu;
    printf("2. %s %d %lf \n", (*ps).name, (*ps).age, (*ps).score);

    printf("3. %s %d %lf \n", ps->name, ps->age, ps->score);

    system("pause");
    return 0;
}